package com.jvm;

import sun.security.action.PutAllAction;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicStampedReference;
import java.util.concurrent.atomic.LongAdder;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 项目名称: java_algorithm
 * @ClassName LongAdder
 * @Description
 * @Author huipanxing huipanxing@chinasofti.com   @Date 2021/10/7 14:10
 */
public class LongAdderTest {
    public static void main(String[] args) throws InterruptedException {
//        LongAdder longAdder=new LongAdder();
//        longAdder.add(1);
//        System.out.println(longAdder.intValue());

//        HashMap hashMap=new HashMap(4);
//        hashMap.put("1","1");
//        hashMap.put("2","2");
//        hashMap.put("3","3");
//        hashMap.put("4","4");
//        System.out.println(hashMap);

//        System.out.println(ClassLoader.getSystemClassLoader());
//        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader().getParent();
//        System.out.println(systemClassLoader);
//        System.out.println(systemClassLoader.getParent());
//
//        Lock lock=new ReentrantLock();
//        Condition condition = lock.newCondition();
//        condition.signal();
//        condition.await();

//        AtomicInteger atomicInteger=new AtomicInteger();
//        atomicInteger.addAndGet(1);
//        atomicInteger.compareAndSet(1,2);
//        System.out.println(atomicInteger.get());

        AtomicStampedReference atomicStampedReference=new AtomicStampedReference(100,1);
//        atomicStampedReference.attemptStamp(200,1);
        atomicStampedReference.compareAndSet(100,200,atomicStampedReference.getStamp(),atomicStampedReference.getStamp()+1);
        System.out.println(atomicStampedReference.getReference());
    }
}
